﻿using Furion.EventBus;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Threading.Tasks;

namespace KseCms.Application
{
    public class PaySuccessEventSubscriber : IEventSubscriber
    {
        private readonly ILogger<PaySuccessEventSubscriber> _logger;
        public PaySuccessEventSubscriber(ILogger<PaySuccessEventSubscriber> logger)
        {
            _logger = logger;
        }

        [EventSubscribe(EventType.PaySuccess)]
        public async Task NoticeTransportService(EventHandlerExecutingContext context)
        {
            var todo = context.Source;
           
            _logger.LogInformation("Event::notice shipping service", todo.Payload);

            await Task.CompletedTask;
        }

        [EventSubscribe(EventType.PaySuccess)]
        public async Task NoticeOrderService(EventHandlerExecutingContext context)
        {
            var todo = context.Source;

            _logger.LogInformation("Event::make order status => OrderStatus.WaitToReceive", todo.Payload);

            await Task.CompletedTask;
        }
    }
}
